package lq2139;

import java.util.Scanner;

public class Main {
 static final int MOD = 1000000007;
 //6模1000000007的逆元
 static final long INV6 = 166666668;
 //平方和计算，计算同时求模
 public static long squareSum(long factor){
     return ((factor * (factor + 1) % MOD) * ((2 * factor + 1) % MOD) % MOD * INV6 % MOD);
 }
 public static void main(String[] args) {
     Scanner scan = new Scanner(System.in);
     int n = scan.nextInt();
     long anwser = 0L;
     
     //数论分块右届
     long right;
     //左界left遍历全部块
     for(long left = 1L; left <= n; left = right + 1){
    	 //计算右届
         right = n / (n / left);
         //计算平方和
         anwser += (squareSum(right) - squareSum(left - 1)) * (n / left) % MOD;
         //转换正余数
         anwser = (anwser + MOD) % MOD;
     }
     scan.close();
     System.out.println(anwser);
 }
}